<?php

namespace app\index\controller;
use think\facade\Request;
use think\facade\Validate;

class Category{
    public function add(){
        echo "增加";
    }
    public function delete(){
        $categoryid = Request::param("category_id");
        //要校验数据
        $array = array(
            'category_id' => $categoryid
        );

        //定义一个规则
        $validate = Validate::rule(
            [
                'category_id' =>"require",
            ]
        );
        //检测数据
        $checkRequest = $validate->check($array);
        var_dump($checkRequest);
    }
}